package com.tale.competition.common.util;

import org.springframework.util.DigestUtils;

public class MD5Util {
    private static final String salt = "cqf14";

    /**
     * md5加密
     * @param str
     * @return
     */
    public static String md5(String str){
        String s = DigestUtils.md5DigestAsHex(str.getBytes());

        return s;
    }

    /**
     * 加盐加密
     * @param str
     * @return
     */
    public static String saltEncryption(String str) {

        str = salt.charAt(1) + salt.charAt(4) + str + salt.charAt(2);

        return md5(str);

    }
}
